﻿CREATE TABLE [dbo].[CAMBIO_PARTIDAS](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[IdOrigen] [int] NOT NULL,
	[IdDestino] [int] NOT NULL,
	[Monto] [decimal](18, 2) NOT NULL,
	[NroResolucion] [nvarchar](6) NOT NULL,
 CONSTRAINT [PK_dbo.CAMBIO_PARTIDAS] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdDestino]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[CAMBIO_PARTIDAS]  WITH CHECK ADD  CONSTRAINT [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdDestino] FOREIGN KEY([IdDestino])
REFERENCES [dbo].[PARTIDA] ([Id])
GO

ALTER TABLE [dbo].[CAMBIO_PARTIDAS] CHECK CONSTRAINT [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdDestino]
GO
/****** Object:  ForeignKey [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdOrigen]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[CAMBIO_PARTIDAS]  WITH CHECK ADD  CONSTRAINT [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdOrigen] FOREIGN KEY([IdOrigen])
REFERENCES [dbo].[PARTIDA] ([Id])
GO

ALTER TABLE [dbo].[CAMBIO_PARTIDAS] CHECK CONSTRAINT [FK_dbo.CAMBIO_PARTIDAS_dbo.PARTIDA_IdOrigen]
GO
CREATE NONCLUSTERED INDEX [IX_IdDestino] ON [dbo].[CAMBIO_PARTIDAS] 
(
	[IdDestino] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_IdOrigen] ON [dbo].[CAMBIO_PARTIDAS] 
(
	[IdOrigen] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]